import {reqAddressInfo,reqOrderInfo} from '@/api'
// 购物车订单交易组件仓库
const state={
  address:[],
  OrderInfo:{}
}
const mutations={
  GETADDRESSINFO(state,address){
    state.address=address
  },

  GETORDERINFO(state,OrderInfo){
    state.OrderInfo=OrderInfo
  }
}
const actions={
//获取用户地址信息
async getAddressInfo({commit}){
  let result=await reqAddressInfo()
  console.log(result);
  if(result.code==200){
    commit('GETADDRESSINFO',result.data)
  }
},

//获取交易商品信息
async getOrderInfo({commit}){
let result=  await reqOrderInfo()
console.log(result);
if(result.code==200){
  commit('GETORDERINFO',result.data)
}}
}
const getters={}
export default{
  state,
  mutations,
  actions,
  getters
}
